import Vue from 'vue'
import VueRouter from 'vue-router'
// ---------------------------------------------------------
import login from '@/views/login/login.vue'
import home from '@/views/home/home.vue'
import index from '@/views/home/index/index.vue'
import my from '@/views/home/My/my.vue'
import detail from '@/views/detail/detail.vue'
import info from '@/views/info/info.vue'
import zhi from '@/views/zhi/zhi.vue'
// 导入search
import search from '@/views/home/search/search.vue'
import searchResult from '@/views/searchResult/searchResult.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: login
  },
  {
    path: '/checklogin',
    component: login
  },
  {
    path: '/home',
    component: home,
    redirect: '/index',
    children: [
      {
        path: '/index',
        component: index
      },
      {
        path: '/my',
        component: my
      },
      {
        path: '/search',
        component: search
      },
      {
        path: '/searchResult/:key',
        component: searchResult
      }
    ]
  },
  {
    path: '/detail/:artId',
    component: detail
  },
  {
    path: '/info',
    component: info
  },
  {
    path: '/zhi',
    component: zhi
  }
]

const router = new VueRouter({
  routes
})

export default router
